package com.zprmb.udzt.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.zprmb.udzt.BaseActivity;
import com.zprmb.udzt.MainActivity;
import com.zprmb.udzt.MainActivity2;
import com.zprmb.udzt.R;
import com.zprmb.udzt.myloading.AVLoadingIndicatorView;
import com.zprmb.udzt.util.Constant;
import com.zprmb.udzt.util.Regular;
import com.zprmb.udzt.util.TimeCount;

/**

 */

public class SuccessZhitouBaoyueActivity extends BaseActivity implements View.OnClickListener {


    TextView tv_title;
    private AVLoadingIndicatorView avi;
    private TimeCount timeCount;

    TextView text_time;
    //返回按钮
    ImageView img_back;

    TextView text_result;
    TextView text_money;
    TextView text_qixi;
    TextView text_shouyidaozhang;
    TextView text_name;
    //查看投资记录
    Button btn_jilu;
    Button btn_invest;


    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_success_yue);
        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_title.setText("投资结果");
        text_name = (TextView) findViewById(R.id.text_name);
        img_back = (ImageView) findViewById(R.id.img_back);
        btn_invest = (Button) findViewById(R.id.btn_invest);
        btn_invest.setOnClickListener(this);
        img_back.setOnClickListener(this);
        text_result = (TextView) findViewById(R.id.text_result);
        //投资记录
        btn_jilu = (Button) findViewById(R.id.btn_jilu);
        btn_jilu.setOnClickListener(this);
        text_money = (TextView) findViewById(R.id.text_money);
        text_qixi = (TextView) findViewById(R.id.text_qixi);
        text_shouyidaozhang = (TextView) findViewById(R.id.text_shouyidaozhang);
        try {

            text_name.setText(getIntent().getStringExtra("title"));

//        text_result.setText(getIntent().getStringExtra("name"));

            String resule = getIntent().getStringExtra("investmoney");

            text_result.setText(Regular.getDecimalFormatTwo(Double.valueOf(resule)) + "元");


//        text_money.setText();
//            text_qixi.setText(Regular.getDecimalFormatTwo(Double.valueOf(getIntent().getStringExtra("qitou"))));
            text_qixi.setText(getIntent().getStringExtra("qixi"));
//        text_shouyidaozhang.setText(getIntent().getStringExtra("jieshu"));
            text_shouyidaozhang.setText(getIntent().getStringExtra("jieshu"));
        } catch (Exception e) {

        }

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.btn_jilu:
//                tab_tag_liebiao

                Intent intent = new Intent(SuccessZhitouBaoyueActivity.this, V6WebviewChild_SuccessYue.class);
                //智投宝
//                intent.putExtra("url", Constant.URL + "h5/currentDetail?&app=true&appversion=true&token=");
                intent.putExtra("url", Constant.URL + "h5/currentDetail?action=1&isInvest=1");
                startActivity(intent);
                finish();
                break;

            case R.id.btn_invest:
              /*  if (getIntent().getStringExtra("str_receive").equals(1)){
                    //跳转智投宝
                    MainActivity.newInstance().setCurrentTabByTag("tab_tag_dextrity");
                    SuccessActivity.this.finish();
                }else {

                }*/
                //跳转列表页面
//                MainActivity.newInstance().setCurrentTabByTag("tab_tag_liebiao");
                try {
                    MainActivity.newInstance().setCurrentTabByTag("tab_tag_liebiao");
                }catch (Exception e){

                }
                try {
                    MainActivity2.newInstance().setCurrentTabByTag("tab_tag_liebiao");
                }catch (Exception e){

                }

                SuccessZhitouBaoyueActivity.this.finish();
//                intent.putExtra("active_url", Constant.URL + "h5/currentDetail?isInvest=1&flagFresh=" + false + "&isFirstInvest=" + firstType + "&productType=" + "dexterity" + "&amount=" + amount + "&action=1&app=true&token=");
                break;

        }
    }
}
